import React from 'react'

import Index from './comp/Index'
import WebSite from './comp/WebSite'
import Sms from './comp/Sms'
import UserInfo from './comp/UserInfo'
import Identify from './comp/Identify'
import Message from './comp/Message'
import Money from './comp/Money'
import Order from './comp/Order'

import {Route, Switch, Redirect} from 'react-router-dom'

const RouteConfig = [
    {
        path: '/index',
        component: Index
    },
    {
        path: '/webSite',
        component: WebSite
    },
    {
        path: '/sms',
        component: Sms
    },
    {
        path: '/userInfo',
        component: UserInfo
    },
    {
        path: '/identify',
        component: Identify
    },
    {
        path: '/message',
        component: Message
    },
    {
        path: '/money',
        component: Money
    },
    {
        path: '/order',
        component: Order
    }
];

console.log(RouteConfig.map(function (route, index) {
    return <Route key={index} path={route.path} component={route.component}/>
}));

class Content extends React.Component {

    render() {



        return <div>
            <Switch>
                {RouteConfig.map(function (route, index) {
                    return <Route key={`route${index}`} path={route.path} component={route.component}/>
                })}
                <Redirect to="/index"/>
            </Switch>
        </div>
    }
}

export default Content;